﻿using System;

namespace FlickrSL
{
    public class FlickrServiceException : Exception
    {
        private Int32 m_ErrorCode;

        public Int32 ErrorCode
        {
            get { return this.m_ErrorCode; }
        }

        public Boolean IsCommonError
        {
            get { return Enum.IsDefined(typeof(CommonErrorCodes), this.m_ErrorCode); }
        }

        public CommonErrorCodes GetCommonErrorCode
        {
            get
            {
                if (this.IsCommonError)
                {
                    return (CommonErrorCodes)this.m_ErrorCode;
                }
                else
                {
                    return CommonErrorCodes.None;
                }
            }
        }

        public FlickrServiceException(String message, Int32 errorCode)
            : base(message)
        {
            this.m_ErrorCode = errorCode;
        }
    }
}
